home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr05
/
ewdins.zip
/
AUTOINS.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1993-06-03
|
2KB
|
77 lines
{************************************************}
{ }
{ E! for Windows }
{ (c) - Patrick Philippot - 1992-1993 }
{ }
{ AutoIns Extension DLL - version 1.0 }
{ }
{ This DLL modifies the basic behavior of the }
{ AutoInsert function. Currently, when auto- }
{ inserting a right brace, EW doesn't move }
{ the cursor where you would expect, that is, }
{ just before the right brace. Some users prefer }
{ the original behavior. If you don't, install }
{ this DLL. }
{ }
{************************************************}
(*
To use this DLL simply load it from the user menu or add its name to the
list of autoloaded Extension DLLs by using the Autoload dialog box from
the User Menu of EW. That's all. This extension cannot be executed because
it only adds a hook responding to E! notifications. AutoIns exports no
EWExecute function.
After installation and if AutoInsert has been checked in the Local Default
dialog box from the Control Center, the AutoInsert function behavior will
be modified. After execution, the cursor will be moved backwards one
position and will be located between the left and right braces.
Please refer to the documentation for details about the AutoInsert feature.
This small piece of code also shows you how easy it is to modify basic
functions of E!.
*)
{$IFDEF DEBUG}
{$A+,G+,B-,D+,E-,F+,I-,N-,R+,S+,V-,L+,Q+,Y+,K+,X+}
{$ELSE}
{$A+,G+,B-,D-,E-,F+,I-,N-,R-,S-,V-,L-,Q-,Y-,K+,X+}
{$ENDIF}
{$C MOVEABLE PRELOAD DISCARDABLE}
library AutoIns;
uses WinTypes, EWApiImp, Strings;
{$I ewuser.inc}
var
SaveExit : Pointer;
function NotifyHook(eventcode : word; wParam : word; lParam : longint) : integer; export;
begin
NotifyHook := 0; {-A non-zero value would break the hook chain}
if (eventcode = ewNotify_CharExit)
and (Char(Lo(wParam)) in [')', ']', '}'])
and (EWGetLocalFlag(EWLclbAutoInsert) <> 0)
and (EWGetInsertState <> 0) then
EWPrevCol;
end;
procedure LibExit; far;
begin
EWRemoveHook(EWHook_Notify, @NotifyHook);
ExitProc := SaveExit;
end;
exports
NotifyHook index 1;
begin
EWSetHook(EWHook_Notify, @NotifyHook);
SaveExit := ExitProc;
ExitProc := @LibExit;
end.